{{template "admin/public/head.html" .}}
<section>
	<aside>
		{{template "admin/public/nav.html" .}}
	</aside>
	<article>
		<div class="top-title">
			<dl>
				<dt><h1>{{.title}}</h1></dt>
				<dd>&nbsp;</dd>
				<dd><a href="wood_help.html"><i class="iconfont">&#xe649;</i>帮助文档</a></dd>
			</dl>
		</div>
		<div class="content">
			<div class="release">
				<dl>
					<dt><i class="iconfont">&#xe649;</i> <b>{{.title}}说明</b><br>
						<p>不同功能代表不同的显示效果，请先选择您需要显示的模块</p>
					</dt>
				</dl>
			</div>
			<form action="" method="get" autocomplete="on" class="form">

				<table class="table1">
					<!-- 控制表格宽度  横向合并 colspan="1"  竖向合并 rowspan="3" -->
					<thead><th width="10%"></th><th width="15%"></th><th width="10%"></th><th width="15%"></th><th width="10%"></th><th width="15%"></th><th width="10%"></th><th width="15%"></th></thead>
					<tr>
						<td class="genre">名称</td>
						<td colspan="3">
							<input type="text" class="input95" placeholder="请输入名称！" name="name" value="{{.info.name}}">
						</td>
						<td class="genre">状态</td>
						<td colspan="3">
							<label class="demo--label"><input class="demo--radio" type="radio" name="Dis" value="1" {{if .info}}{{if eq .info.Dis "1"}}checked{{end}}{{else}}checked{{end}}><span class="demo--radioInput"></span>已显示</label>
							<label class="demo--label"><input class="demo--radio" type="radio" name="Dis" value="0" {{if .info}}{{if eq .info.Dis "0"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>已隐藏</label>
						</td>
					</tr>
					<tr>
						<td class="genre">图片</td>
						<td colspan="7">
							<div class="thumbnail">
								<dl>
									<dt>
										<img src="{{if .info.pathname}}{{.info.pathname}}{{else}}/static/all/uppic.png{{end}}" class="uppic">
										<input type="file" onchange="uppic(this, 'function')" accept="image/*">
										<input type="hidden" name="img" value="{{.info.img}}">
									</dt>
									<dd>缩略图</dd>
									<dd class="del_img">删除图片</dd>
								</dl>
								<dl>(200 * 200)</dl>
							</div>
						</td>
					</tr>
					<tr>
						<td class="genre">选择功能</td>
						<td colspan="8">
							<label class="demo--label"><input class="demo--radio" type="radio" name="style" value="0" {{if .info}}{{if eq .info.style "0"}}checked{{end}}{{else}}checked{{end}}><span class="demo--radioInput"></span>产区</label>
							<label class="demo--label"><input class="demo--radio" type="radio" name="style" value="1" {{if .info}}{{if eq .info.style "1"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>品牌街</label>
							<label class="demo--label"><input class="demo--radio" type="radio" name="style" value="2" {{if .info}}{{if eq .info.style "2"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>活动显示</label>
							<label class="demo--label"><input class="demo--radio" type="radio" name="style" value="3" {{if .info}}{{if eq .info.style "3"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>产品结构</label>
							<label class="demo--label"><input class="demo--radio" type="radio" name="style" value="4" {{if .info}}{{if eq .info.style "4"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>新手加入</label>
							<label class="demo--label"><input class="demo--radio" type="radio" name="style" value="5" {{if .info}}{{if eq .info.style "5"}}checked{{end}}{{end}}><span class="demo--radioInput"></span>商品类别</label>
						</td>
					</tr>
					<tr class="inenter" style="display: none">
						<td colspan="8"><input type="text" class="select95 shopsx" placeholder="筛选(店铺)"></td>
					</tr>
					<tr class="shop opt" style="display: none">
						<td colspan="8">
						{{range .shop}}
						<label class="checkbox"><input type="checkbox" name="sid" value="{{.id}}" {{if $.info.sid}}{{tipcheck .id $.info.sid}}{{end}}>{{.name}}</label>
						{{end}}
						</td>
					</tr>
					<tr class="opt" style="display: none">
						<td class="genre">选择品牌街</td>
						<td  colspan="8">
							{{range .brandclassify}}
							<label class="demo--label"><input class="demo--radio" type="radio" name="brandclassify" value="{{.id}}" {{if $.info.brandclassify}}{{if eq .id $.info.brandclassify}}checked{{end}}{{end}}><span class="demo--radioInput"></span>{{.name}}</label>
							{{end}}
						</td>
					</tr>
					<tr class="opt" style="display: none">
						<td class="genre">选择活动</td>
						<td  colspan="8">
							{{range .program}}
							<label class="demo--label"><input class="demo--radio" type="radio" name="program" value="{{.id}}" {{if $.info.program}}{{if eq .id $.info.program}}checked{{end}}{{end}}><span class="demo--radioInput"></span>{{.name}}</label>
							{{end}}
						</td>
					</tr>
					<tr class="opt" style="display: none">
						<td class="genre">选择商品结果</td>
						<td  colspan="8">
							{{range .structure}}
							<label class="demo--label"><input class="demo--radio" type="radio" name="structure" value="{{.id}}" {{if $.info.structure}}{{if eq .id $.info.structure}}checked{{end}}{{end}}><span class="demo--radioInput"></span>{{.name}}</label>
							{{end}}
						</td>
					</tr>
					<tr class="opt" style="display: none">
						<td class="genre">选择新手导航</td>
						<td  colspan="8">
							{{range .Novice}}
							<label class="demo--label"><input class="demo--radio" type="radio" name="Novice" value="{{.id}}" {{if $.info.Novice}}{{if eq .id $.info.Novice}}checked{{end}}{{end}}><span class="demo--radioInput"></span>{{.name}}</label>
							{{end}}
						</td>
					</tr>
					<tr class="opt" style="display: none">
						<td class="genre">选择商品类别</td>
						<td  colspan="8">
							{{range .maincolumn}}
							<label class="demo--label"><input class="demo--radio" type="radio" name="maincolumn" value="{{.id}}" {{if $.info.maincolumn}}{{if eq .id $.info.maincolumn}}checked{{end}}{{end}}><span class="demo--radioInput"></span>{{.name}}</label>
							{{end}}
						</td>
					</tr>
					<input type="hidden" name="id" value="{{.info.id}}">
			</form>
					<tr class="trbutton">
						<td colspan="2"><button type="button" class="button">保存</button></td>
						<td colspan="6">
							<p>
								<i class="iconfont">&#xe649;</i> 请检查内容确认发布的内容没有涉及传播谣言、政治话题或违反广告法夸大宣传产品等。
							</p>
							<div class="help">帮助
								<div class="help_qr"><img src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/all/qr-code.jpg" alt=""></div>
							</div>
						</td>
					</tr>
				</table>
		</div>
	</article>
</section>

<footer><!-- 系统监控内容 --></footer>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/jquery.jedate.min.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/toast.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/uppic.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/xcConfirm.js"></script>
<script src="https://tcsc.oss-cn-hangzhou.aliyuncs.com/static/admin/js/app.js"></script>
<script>
	var str = {{.info.style}}
	if ({{.info}}) {
		if ({{.info.style}}==0) {
			$('.inenter').removeAttr("style")
		}
		$('.opt').eq({{.info.style}}).removeAttr("style")
	} else {
		$('.opt').eq(0).removeAttr("style")
	}
	$('input[name="style"]').click(function(){
		if ($(this).val()==0) {
			$('.inenter').removeAttr("style")
		} else {
			$('.inenter').css("display","none")
		}
		$('.opt').css("display","none")
		$('.opt').eq($(this).val()).removeAttr("style")
		str = $(this).val()
	})

	$('.shopsx').bind('input propertychange', {els: $('.shop label')}, search)

	function search(e){
		var val = $(this).val().trim();
		var reg = new RegExp(val);
		e.data.els.each(function() {
			var val = $(this).text()
			if (!reg.test(val)) {
				$(this).hide()
			} else {
				$(this).show()
			}
		})
	}
	$('.button').click(function(){
		if (!$('input[name="name"]').val().trim()){
			window.wxc.xcConfirm("请输入名称！","info"); return false;
		}
		if (!$('input[name="img"]').val()) {
			window.wxc.xcConfirm("请上传主图！","info"); return false;
		}
		if (!$('input[name="sid"]').is(":checked") && str==0) {
			window.wxc.xcConfirm("请至少选择一个店铺！","info"); return false;
		}
		if (!$('input[name="brandclassify"]').is(":checked") && str==1) {
			window.wxc.xcConfirm("请选择品牌街！","info"); return false;
		}
		if (!$('input[name="program"]').is(":checked") && str==2) {
			window.wxc.xcConfirm("请选择活动！","info"); return false;
		}
		if (!$('input[name="structure"]').is(":checked") && str==3) {
			window.wxc.xcConfirm("请选择商品结构！","info"); return false;
		}
		if (!$('input[name="Novice"]').is(":checked") && str==4) {
			window.wxc.xcConfirm("请选择新手活动！","info"); return false;
		}
		var form=$('form').serialize()
		$.ajax({
			url:window.location.href,
			data:form,
			type:'post',
			success:function(res){
				console.log(res)
				if(res.status == 1){
					 window.wxc.xcConfirm("保存成功","success",{onClose:function(){
                        window.location.href = document.referrer
                    }})
				}else {
					 window.wxc.xcConfirm("保存失败,请重试!","error")
				}
			}
		})
	});
</script>
</body>
</html>
